﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DnEcuDiag.Conversion
{
    abstract class KwpConvertor : Convertor
    {
        protected readonly float[] Me21NonTurboAirTemp;
        protected readonly float[] Me21NonTurboEngineTemp;
        protected readonly float[] Me21TurboAirTemp;
        protected readonly float[] Me21TurboEngineTemp;
        
        protected KwpConvertor()
        {
            #region ME2.1 Temp

            Me21NonTurboAirTemp = new[]
                                       {
                                           -50.1f, -50.09f, -50.07f, -50.06f, -50.04f, -50.03f, -50.01f, -50f, -48f,
                                           -47f, -45f, -43f, -41f,
                                           -40f,
                                           -39f, -37f, -36f, -35f, -34f, -32f, -31f, -30f, -29f, -28.5f, -28f, -27f,
                                           -26f, -25f, -24f, -23.5f,
                                           -23f, -22f,
                                           -21f, -20.5f, -20f, -19f, -18.5f, -18f, -17f, -16.5f, -16f, -15.5f, -15f,
                                           -14f, -13.5f, -13f, -12.5f
                                           , -12f,
                                           -11.5f, -11f, -10.5f, -10f, -9.5f, -9f, -8.5f, -8f, -7.5f, -7f, -6.5f, -6f,
                                           -5.5f, -5f, -4.5f, -4f,
                                           -3.5f, -3f,
                                           -2.5f, -2f, -1.5f, -1f, -0.5f, 0f, 0.33f, 0.67f, 1f, 1.5f, 2f, 2.5f, 3f,
                                           3.33f, 3.67f, 4f, 4.5f, 5f,
                                           5.5f, 6f, 6.33f,
                                           6.67f, 7f, 7.5f, 8f, 8.33f, 8.67f, 9f, 9.5f, 10f, 10.33f, 10.67f, 11f, 11.5f,
                                           12f, 12.33f, 12.67f,
                                           13f, 13.5f,
                                           14f, 14.33f, 14.67f, 15f, 15.5f, 16f, 16.33f, 16.67f, 17f, 17.5f, 18f, 18.5f,
                                           19f, 19.33f, 19.67f,
                                           20f, 20.5f,
                                           21f, 21.33f, 21.67f, 22f, 22.5f, 23f, 23.33f, 23.67f, 24f, 24.5f, 25f, 25.33f
                                           , 25.67f, 26f, 26.5f,
                                           27f, 27.5f,
                                           28f, 28.33f, 28.67f, 29f, 29.5f, 30f, 30.5f, 31f, 31.5f, 32f, 32.33f, 32.67f,
                                           33f, 33.5f, 34f, 34.5f
                                           , 35f, 35.5f,
                                           36f, 36.5f, 37f, 37.5f, 38f, 38.5f, 39f, 39.5f, 40f, 40.5f, 41f, 41.5f, 42f,
                                           42.5f, 43f, 43.5f, 44f,
                                           44.5f, 45f, 45.5f, 46f,
                                           46.5f, 47f, 48f, 48.5f, 49f, 49.5f, 50f, 50.5f, 51f, 52f, 52.5f, 53f, 54f,
                                           54.5f, 55f, 56f, 56.5f,
                                           57f, 58f,
                                           58.5f, 59f, 60f, 61f, 61.5f, 62f, 63f, 64f, 65f, 65.5f, 66f, 67f, 68f, 69f,
                                           70f, 71f, 72f, 73f, 74f,
                                           75f, 76f, 77f, 78f, 79f, 80f,
                                           82f, 83f, 84f, 86f, 87f, 89f, 90f, 92f, 93f, 95f, 96.67f, 98.33f, 100f,
                                           102.5f, 105f, 107.5f, 110f,
                                           112.5f, 115f,
                                           120f, 122.5f, 125f, 130f, 135f, 140f, 145f, 150f, 150.01f, 150.03f, 150.04f,
                                           150.05f, 150.06f,
                                           150.08f, 150.09f
                                       };

            Me21NonTurboEngineTemp = new[]
                                          {
                                              -59f, -51.5f, -46.3f, -42.3f, -39f, -36.1f, -33.6f, -31.3f, -29.3f, -27.4f
                                              , -25.7f, -24.1f, -22.6f,
                                              -21.2f, -19.8f, -18.5f, -17.3f, -16.1f, -15f, -14f, -12.9f, -11.9f, -10.9f
                                              , -10f, -9.1f, -8.2f,
                                              -7.4f,
                                              -6.5f, -5.7f, -4.9f, -4.1f, -3.4f, -2.6f, -1.9f, -1.2f, -0.5f, 0.2f, 0.9f,
                                              1.6f, 2.2f, 2.9f, 3.5f,
                                              4.2f, 4.8f,
                                              5.4f, 6f, 6.6f, 7.2f, 7.7f, 8.3f, 8.9f, 9.4f, 10f, 10.5f, 11.1f, 11.6f,
                                              12.2f, 12.7f, 13.2f, 13.7f,
                                              14.3f,
                                              14.8f, 15.3f, 15.8f, 16.3f, 16.8f, 17.3f, 17.8f, 18.2f, 18.7f, 19.2f,
                                              19.7f, 20.2f, 20.6f, 21.1f,
                                              21.6f, 22f,
                                              22.5f, 23f, 23.4f, 23.9f, 24.3f, 24.8f, 25.3f, 25.7f, 26.2f, 26.6f, 27.1f,
                                              27.5f, 28f, 28.4f, 28.8f,
                                              29.3f, 29.7f,
                                              30.2f, 30.6f, 31f, 31.5f, 31.9f, 32.4f, 32.8f, 33.2f, 33.7f, 34.1f, 34.5f,
                                              35f, 35.4f, 35.9f, 36.3f,
                                              36.7f, 37.2f, 37.6f,
                                              38f, 38.5f, 38.9f, 39.4f, 39.8f, 40.2f, 40.7f, 41.1f, 41.6f, 42f, 42.4f,
                                              42.9f, 43.3f, 43.8f, 44.2f,
                                              44.7f, 45.1f, 45.6f,
                                              46f, 46.5f, 46.9f, 47.4f, 47.8f, 48.3f, 48.8f, 49.2f, 49.7f, 50.1f, 50.6f,
                                              51.1f, 51.5f, 52f, 52.5f,
                                              53f, 53.5f, 53.9f, 54.4f, 54.9f,
                                              55.4f, 55.9f, 56.4f, 56.9f, 57.4f, 57.9f, 58.4f, 58.9f, 59.4f, 59.9f,
                                              60.5f, 61f, 61.5f, 62.1f,
                                              62.6f, 63.1f, 63.7f, 64.2f, 64.8f, 65.3f,
                                              65.9f, 66.5f, 67f, 67.6f, 68.2f, 68.8f, 69.4f, 70f, 70.6f, 71.2f, 71.9f,
                                              72.5f, 73.1f, 73.8f, 74.4f,
                                              75.1f, 75.7f, 76.4f, 77.1f, 77.8f,
                                              78.5f, 79.2f, 79.9f, 80.7f, 81.4f, 82.2f, 82.9f, 83.7f, 84.5f, 85.3f,
                                              86.1f, 86.9f, 87.8f, 88.7f,
                                              89.6f, 90.5f, 91.4f, 92.3f, 93.2f, 94.2f,
                                              95.2f, 96.2f, 97.3f, 98.3f, 99.4f, 100.5f, 101.7f, 102.9f, 104.1f, 105.3f,
                                              106.6f, 107.9f, 109.3f,
                                              110.7f, 112.2f, 113.7f, 115.2f,
                                              116.9f, 118.6f, 120.3f, 122.2f, 124.1f, 126.1f, 128.3f, 130.5f, 132.8f,
                                              135.3f, 138f, 140.8f, 143.8f
                                              , 147.1f, 150.6f, 154.4f, 158.6f,
                                              163.2f, 168.2f, 174.2f, 180.7f, 188.7f, 197.7f, 209.7f, 232.27f, 254.85f,
                                              277.43f, 300f, 300.1f
                                          };

            #endregion ME2.1 Temp

            #region ME2.1T Temp

            Me21TurboEngineTemp = new[]
                                       {
                                           -41f, -40.8f, -40.6f, -40.4f, -40.2f, -40f, -37.5f, -35f, -32.5f, -30f,
                                           -28.36f, -26.72f, -25.08f,
                                           -23.43f, -21.79f, -20.15f,
                                           -19.04f, -19.72f, -16.81f, -15.69f, -14.58f, -13.46f, -12.35f, -11.23f,
                                           -10.12f, -9.29f, -8.46f,
                                           -7.63f, -6.79f, -5.96f, -5.13f, -4.3f, -3.47f, -2.64f, -1.8f, -0.97f, -0.14f,
                                           0.45f, 1.05f, 1.64f, 2.23f, 2.82f, 3.42f, 4.01f, 4.6f, 5.2f, 5.79f, 6.38f,
                                           6.98f, 7.57f, 8.16f,
                                           8.75f, 9.35f, 9.94f, 10.44f, 10.94f, 11.45f, 11.95f, 12.45f, 12.95f, 13.45f,
                                           13.96f, 14.46f,
                                           14.96f, 15.46f, 15.96f, 16.47f, 16.97f, 17.47f, 17.97f, 18.47f, 18.98f,
                                           19.48f, 19.98f, 20.43f,
                                           20.89f, 21.34f, 21.8f, 22.25f, 22.71f, 23.16f, 23.62f, 24.07f, 24.53f, 24.98f
                                           , 25.44f,
                                           25.9f, 26.35f, 26.81f, 27.27f, 27.73f, 28.19f, 28.65f, 29.1f, 29.56f, 30.02f,
                                           30.45f, 30.89f, 31.32f
                                           , 31.75f, 32.18f, 32.62f, 33.05f, 33.48f, 33.91f, 34.35f, 34.78f, 35.21f,
                                           35.64f,
                                           36.08f, 36.51f, 36.94f, 37.37f, 37.81f, 38.24f, 38.67f, 39.1f, 39.54f, 39.97f
                                           , 40.41f, 40.84f,
                                           41.28f, 41.71f, 41.15f, 42.58f, 43.02f, 43.45f, 43.98f, 44.32f, 44.76f,
                                           45.19f, 45.63f,
                                           46.06f, 46.5f, 46.93f, 47.37f, 47.8f, 48.24f, 48.67f, 49.11f, 49.54f, 49.98f,
                                           50.46f, 50.93f, 51.41f
                                           , 51.89f, 52.37f, 52.84f, 53.32f, 53.8f, 54.27f, 54.75f, 55.23f, 55.71f,
                                           56.18f,
                                           56.66f, 57.14f, 57.61f, 58.09f, 58.57f, 59.05f, 59.52f, 60f, 60.56f, 61.12f,
                                           61.68f, 62.24f, 62.8f,
                                           63.56f, 63.92f, 64.48f, 65.04f, 65.6f, 66.16f, 66.72f, 67.28f, 67.84f, 68.4f,
                                           68.96f,
                                           69.52f, 70.08f, 70.74f, 71.41f, 72.07f, 72.73f, 73.4f, 74.06f, 74.72f, 75.39f
                                           , 76.05f, 76.71f,
                                           77.38f, 78.04f, 78.7f, 79.37f, 80.03f, 80.86f, 81.69f, 82.52f, 83.35f, 84.18f
                                           , 85.02f,
                                           85.85f, 86.68f, 87.51f, 88.34f, 89.17f, 90f, 91f, 91.99f, 92.99f, 93.98f,
                                           94.98f, 95.98f, 96.97f,
                                           97.97f, 98.98f, 99.98f, 101.2f, 102.45f, 103.69f, 104.94f, 106.18f, 107.42f,
                                           108.67f,
                                           109.91f, 111.63f, 113.36f, 115.08f, 116.9f, 118.53f, 120.25f, 122.13f,
                                           124.01f, 125.88f, 127.76f,
                                           129.64f, 130.19f, 130.73f, 131.28f, 131.82f, 132.37f, 132.91f, 133.46f, 134f,
                                           134.55f, 135.09f, 135.64f, 136.18f, 136.73f, 137.27f, 137.82f, 138.36f,
                                           138.91f, 139.45f, 140
                                       };

            Me21TurboAirTemp = new[]
                                    {
                                        -40f, -40f, -40f, -40f, -40f, -40f, -40f, -40f, -40f, -40f, -40f, -40f, -38.57f,
                                        -37.14f, -35.71f,
                                        -34.29f, -32.86f, -31.43f, -30f, -29.17f,
                                        -28.33f, -27.5f, -26.67f, -25.83f, -25f, -24.17f, -23.33f, -22.5f, -21.67f,
                                        -20.83f, -20f, -19.41f,
                                        -18.82f, -18.24f, -17.65f, -17.06f, -16.47f, -15.88f, -15.29f, -14.71f, -14.12f,
                                        -13.53f, -12.94f, -12.35f, -11.76f, -11.18f, -10.59f, -10f, -9.5f, -9f, -8.5f,
                                        -8f, -7.5f, -7f,
                                        -6.5f, -6f, -5.5f, -5f, -4.5f, -4f, -3.5f, -3f, -2.5f, -2f, -1.5f, -1f, -0.5f,
                                        0f, 0.4f, 0.8f, 1.2f,
                                        1.6f, 2f, 2.4f, 2.8f, 3.2f, 3.6f, 4f, 4.4f, 4.8f, 5.2f, 5.6f, 6f, 6.4f, 6.8f,
                                        7.2f, 7.6f, 8f, 8.4f,
                                        8.8f, 9.2f, 9.6f, 10f, 10.4f, 10.8f, 11.2f, 11.6f, 12f, 12.4f, 12.8f, 13.2f,
                                        13.6f, 14f, 14.4f,
                                        14.8f, 15.2f,
                                        15.6f, 16f, 16.4f, 16.8f, 17.2f, 17.6f, 18f, 18.4f, 18.8f, 19.2f, 19.6f, 20f,
                                        20.4f, 20.8f, 21.2f,
                                        21.6f, 22f, 22.4f, 22.8f, 23.2f, 23.6f, 24f, 24.4f, 24.8f, 25.2f, 25.6f, 26f,
                                        26.4f, 26.8f, 27.2f,
                                        27.6f, 28f, 28.4f, 28.8f, 29.2f, 29.6f, 30f, 30.43f, 30.87f, 31.3f, 31.74f,
                                        32.17f, 32.61f, 33.04f,
                                        33.48f, 33.91f, 34.35f, 34.78f, 35.22f, 35.65f, 36.09f, 36.52f, 36.96f, 37.39f,
                                        37.83f,
                                        38.26f, 38.7f, 39.13f, 39.57f, 40f, 40.56f, 41.11f, 41.67f, 42.22f, 42.78f,
                                        43.33f, 43.89f, 44.44f,
                                        45f, 45.56f, 46.11f, 46.67f, 47.22f, 47.78f, 48.33f, 48.89f, 49.44f, 50f, 50.59f
                                        , 51.18f,
                                        51.76f, 52.35f, 52.94f, 53.53f, 54.12f, 54.71f, 55.29f, 55.88f, 56.47f, 57.06f,
                                        57.65f, 58.24f,
                                        58.82f, 59.41f, 60f, 60.83f, 61.67f, 62.5f, 63.33f, 64.17f, 65f, 65.83f, 66.67f,
                                        67.5f, 68.33f,
                                        69.17f, 70f, 71f, 72f, 73f, 74f, 75f, 76f, 77f, 78f, 79f, 80f, 81.43f, 82.86f,
                                        84.29f, 85.71f,
                                        87.14f, 88.57f, 90f, 91.67f, 93.33f, 95f, 96.67f, 98.33f, 100f, 102.5f, 105f,
                                        107.5f, 110f, 113.33f,
                                        116.67f,
                                        120f, 123.33f, 126.67f, 130f, 135f, 140f, 140f, 140f, 140f, 140f, 140f, 140f,
                                        140f, 140
                                    };

            #endregion ME2.1T Temp
        }
    }
}
